<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>mvc</title>
</head>
<body>
<a href="http://web.jobbole.com/85108/">mvc</a>
<a href="http://web.jobbole.com/85099/"> JavaScript的原生函数 </a>
<div id="div1" bind="model1"></div>
<span bind="hour"></span> : <span bind="minute"></span> : <span bind="second"></span>
<!--<div id="div2"></div>-->
<script src="app.js"></script>
<script>
    new Controller(function (models) {
        console.log(models);
//        var model1 = models;
        var model1 = models.model1;
        console.log(model1);
        model1.set('this is a div');
    });

new Controller(function (models) {
    function setTime() {
        var date = new Date();
        models.hour.set(date.getHours());
        models.minute.set(date.getMinutes());
        models.second.set(date.getSeconds());
    }
    setTime();
    setInterval(setTime, 1000);
});

//    (function(){
//        var model = new Model();
//        var div1 = document.getElementById('div1');
//        model.bind(div1);
//        model.bind(document.getElementById('div2'));
//        model.watch(function(value){
//            div1.innerHTML = value;
//        })
//        model.set("hello this is div");
//    })();
</script>
</body>
</html>